import React, { useContext } from "react";
import { Button } from "antd";
import ThemeContext from "../ThemeContext";
import action from '../store/action'
function VoteFooter() {
    let { store } = useContext(ThemeContext);
    return <div className="footer">
        {/* 点击按钮派发任务，通知reducer执行，传递的action行为对象中，type行为标识，要和reducer中进行判断的行为标识，要对应上！！ */}
        <Button type="primary" onClick={() => {
            //组件中进行派发的时候，也是用导出的变量进行派发
            store.dispatch(action.vote.support())
        }}>支持</Button>
        <Button type="primary" danger onClick={() => {
            store.dispatch(action.vote.oppose())
        }}>反对</Button>
    </div>
}
export default VoteFooter
